package com.ruoyi.system.mapper.bm;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.system.domain.BaseBanner;
import com.ruoyi.system.domain.bm.BMPack;
import com.ruoyi.system.domain.dto.Web.BannerDto;

import java.util.List;
import java.util.Objects;


/**
 */
public interface BMPackMapper extends BaseMapper<BMPack>{


    default List<BMPack> selectByList(BMPack dto){
        LambdaQueryWrapper<BMPack> wrapper = new LambdaQueryWrapper<>();
        wrapper.in(CollUtil.isNotEmpty(dto.getContestIds()),BMPack::getContestId,dto.getContestIds());
        wrapper.like(StringUtils.isNotBlank(dto.getName()),BMPack::getName,dto.getName());
        wrapper.eq(Objects.nonNull(dto.getContestId()),BMPack::getContestId,dto.getContestId());
        wrapper.eq(BMPack::getIsDeleted,0);
        wrapper.orderByDesc(BMPack::getCreateTime);
        return selectList(wrapper);
    }
}

